<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title">人员信息</h4>
    </div>
    
</div>

<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <input type="hidden" name="order_id" value="{$order_id}">
    <input type="hidden" name="has_update" id="has_update" value="0">

    <div class="role-container table-responsive">
        <table class="table table-bordered table-striped table-hover">
            <thead>
                <tr>
                    <th class="col-position">岗位名称</th>
                    <th class="col-responsibility">责任类型</th>
                    <th class="col-worker">人员选择</th>
                </tr>
            </thead>
            <tbody>
                {foreach name="jobOffer" item="item"}
                <tr>
                    <td>
                        {$item.position_name}
                        {if condition="$item.current_worker_name"}
                        <span class="label label-success current-worker">当前：{$item.current_worker_name}</span>
                        {/if}
                        {if condition="$item.position_id eq 1"}
                        <span class="label label-default role-tip">不可修改</span>
                        {/if}
                    </td>
                    <td>
                        <select name="row[{$item.position_id}][responsibility]" class="form-control responsibility-select" data-original="{$item.current_responsibility|default='0'}" {if condition="$item.position_id eq 1"}disabled="disabled"{/if}>
                            <option value="0" {if condition="$item.current_responsibility eq 0"}selected{/if}>次责</option>
                            <option value="1" {if condition="$item.current_responsibility eq 1"}selected{/if}>主责</option>
                        </select>
                    </td>
                    <td>
                        <select name="row[{$item.position_id}][user_id]" class="form-control worker-select" data-original="{$item.current_worker_id|default=''}" {if condition="$item.position_id eq 1"}disabled="disabled"{/if}>
                            <option value="">请选择人员</option>
                            {foreach name="item.users" item="user"}
                            <option value="{$user.id}" {if condition="$user.id eq $item.current_worker_id"}selected{/if}>{$user.nickname}</option>
                            {/foreach}
                        </select>
                    </td>
                   <input type="hidden" name="row[{$item.position_id}][position]" value="{$item.position_id|default=''}">
                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>

    <div class="form-group layer-footer">
        <div class="col-xs-12" style="text-align: center;">
            <button type="submit" class="btn btn-primary btn-embossed">{:__('OK')}</button>
        </div>
    </div>
</form>

<style>
.role-container {
    max-height: 620px;
    overflow-y: auto;
    margin-bottom: 15px;
}
.role-container table {
    width: 100%;
    table-layout: fixed;
}
.col-position {
    width: 42%;
}
.col-responsibility {
    width: 18%;
}
.col-worker {
    width: 37%;
}
.worker-select {
    min-width: 180px;
}
.role-container .current-worker {
    font-size: 12px;
    margin-left: 6px;
}
.role-container .role-tip {
    margin-left: 6px;
    background-color: #bdbdbd;
}
.worker-select[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}
</style>

